{php include wl_template('common/header');}
<!-- page 容器 -->
<div class="page">
  <!-- 标题栏 -->
  <header class="bar bar-nav">
    <a class="icon icon-me pull-left open-panel"></a>
    <h1 class="title">生成二维码：绑定柜门与教师</h1>
  </header>
123
  <!-- 这里是页面内容区 -->
  <div class="content main" name="main">
    <div class="row no-gutter">
      <div class="col-10" style="text-align:center;">信息ID</div>
      <div class="col-20" style="text-align:center;">设备名称</div>
      <div class="col-20" style="text-align:center;">柜门号</div>
      <div class="col-20" style="text-align:center;">教师姓名</div>
      <div class="col-30" style="text-align:center;">二维码更新时间</div>
    </div>    
    {loop $current_cabinet $item}
        <div class="row no-gutter" >
            <div class="col-70"><span style="float:right">{$item['device_name']}:{$item['door']}号门</span></div>
            <div class="col-30">               
                {if $item['isshow']==true}
                <input class="show_qr open-about" type="submit" value="显示二维码" info_id="{$item['device_info_id']}" device_name="{$item['device_name']}" door="{$item['door']}" random="{$item['random']}"/>
                {else}
                <input class="show_qr open-about" type="submit" value="显示二维码" info_id="{$item['device_info_id']}" device_name="{$item['device_name']}" door="{$item['door']}"/>
                {/if}            
            </div>
        </div>
        <div class="row no-gutter">
          <div class="col-10" style="text-align:center;">{$item['device_info_id']}</div>
          <div class="col-20" style="text-align:center;">{$item['device_name']}</div>
          <div class="col-20" style="text-align:center;">{$item['door']}</div>
          <div class="col-20" style="text-align:center;"><?php if($item['teacher_name']=='')  echo '暂未绑定';else echo $item['teacher_name'];?></div>
          <div class="col-30" style="text-align:center;"><?php if($item['time']=='') echo '暂未更新'; else echo date("m-d H:i", $item['time']);?></div>
        </div>        
    {/loop}
  </div>
  

</div>
<div class="popup popup-about">
  <div class="content-block">
    <p>此二维码用于绑定柜门与教师</p>
    <p></p>
    <p></p>
    <p></p>
    <p><a href="#" class="close-popup" style=" color:#CD0000; font-size:18px;">请点击此处返回</a></p>
    <div id="qrcode"> </div>
    <p></p>
    <p>注意一个柜门只能绑定一名教师</p>
  </div>
</div>






<script type="text/javascript">
	$(function(){
        $('.open-about').click(function(){
           $.popup('.popup-about');
           var info_id = $(this).attr('info_id');
           var device_name = $(this).attr('device_name');
           var door = $(this).attr('door');
           //var random;
           $.post("{php echo app_url('qrcode/update/door_teacher');}", { info_id : info_id , door : door},function(data){
               var random = data;
			   console.log('2222')
			   console.log(data)
               $('.popup-about p:eq(1)').text('设备信息ID：'+info_id);
               $('.popup-about p:eq(2)').text('设备名称：'+device_name);
               $('.popup-about p:eq(3)').text('柜门号：'+door+'号门');
               $("#qrcode").empty();
               new QRCode(document.getElementById('qrcode'), "{php echo app_url('scangenerate/scan/door_teacher');}"+'info_id='+info_id+'&door='+door+'&random='+random);
               //$('.popup-about p:eq(5)').text("{php echo app_url('scangenerate/scan/door_teacher');}"+'info_id='+info_id+'&door='+door+'&random='+random+'&device_name='+device_name);
           });
           //var random = redd();
           //var random = $(this).attr('random');
           <!-- $('.popup-about p:eq(1)').text('设备信息ID：'+info_id); -->
           <!-- $('.popup-about p:eq(2)').text('设备名称：'+device_name); -->
           <!-- $('.popup-about p:eq(3)').text('柜门号：'+door+'号门'); -->
           <!-- $("#qrcode").empty(); -->
           <!-- new QRCode(document.getElementById('qrcode'), "{php echo app_url('scangenerate/scan/door_teacher');}"+'info_id='+info_id+'&door='+door+'&random='+random+'&device_name='+device_name); -->
           <!-- $('.popup-about p:eq(5)').text("{php echo app_url('scangenerate/scan/door_teacher');}"+'info_id='+info_id+'&door='+door+'&random='+random+'&device_name='+device_name); -->
        });  
        $('.close-about').click(function(){
           $.closeModal('.popup-about');
        });                
	});

</script>

{php include wl_template('common/footer');}
	